import 'package:xinxuan/vo/common_vo/common_costs_vo.dart';
import 'package:xinxuan/vo/common_vo/common_seckill_products_vo.dart';

class CreateSeckillOrderVo {
  CreateSeckillOrderData? data;

  CreateSeckillOrderVo({this.data});

  CreateSeckillOrderVo.fromJson(Map<String, dynamic> json) {
    data = json['data'] != null ? new CreateSeckillOrderData.fromJson(json['data']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data!.toJson();
    }
    return data;
  }
}

class CreateSeckillOrderData {
  int? id;
  String? orderSn;
  String? commissionRate;
  int? payStatus;
  int? teamId;
  int? userId;
  int? status;
  String? statusStr;
  int? source;
  String? payableAmount;
  int? paidAmount;
  int? totalAmount;
  String? createdAt;
  String? updatedAt;
  int? remainingTime;
  List<CommonSeckillProductsVo>? products;
  List<CommonCostsVo>? costs;
  
  CreateSeckillOrderData(
      {this.id,
      this.orderSn,
      this.commissionRate,
      this.payStatus,
      this.teamId,
      this.userId,
      this.status,
      this.statusStr,
      this.source,
      this.payableAmount,
      this.paidAmount,
      this.totalAmount,
      this.createdAt,
      this.updatedAt,
      this.remainingTime,
      this.products,
      this.costs});

  CreateSeckillOrderData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    orderSn = json['order_sn'];
    commissionRate = json['commission_rate'];
    payStatus = json['pay_status'];
    teamId = json['team_id'];
    userId = json['user_id'];
    status = json['status'];
    statusStr = json['status_str'];
    source = json['source'];
    payableAmount = json['payable_amount'];
    paidAmount = json['paid_amount'];
    totalAmount = json['total_amount'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
    remainingTime = json['remaining_time'];
    if (json['products'] != null) {
      products = <CommonSeckillProductsVo>[];
      json['products'].forEach((v) {
        products!.add(new CommonSeckillProductsVo.fromJson(v));
      });
    }
    if (json['costs'] != null) {
      costs = <CommonCostsVo>[];
      json['costs'].forEach((v) {
        costs!.add(new CommonCostsVo.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['order_sn'] = this.orderSn;
    data['commission_rate'] = this.commissionRate;
    data['pay_status'] = this.payStatus;
    data['team_id'] = this.teamId;
    data['user_id'] = this.userId;
    data['status'] = this.status;
    data['status_str'] = this.statusStr;
    data['source'] = this.source;
    data['payable_amount'] = this.payableAmount;
    data['paid_amount'] = this.paidAmount;
    data['total_amount'] = this.totalAmount;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    data['remaining_time'] = this.remainingTime;
    if (this.products != null) {
      data['products'] = this.products!.map((v) => v.toJson()).toList();
    }
    if (this.costs != null) {
      data['costs'] = this.costs!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Costs {
  String? key;
  String? label;
  String? value;

  Costs({this.key, this.label, this.value});

  Costs.fromJson(Map<String, dynamic> json) {
    key = json['key'];
    label = json['label'];
    value = json['value'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['key'] = this.key;
    data['label'] = this.label;
    data['value'] = this.value;
    return data;
  }
}
